home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / logins / jb-learn / jb-learn.mac < prev    next >
Text File  |  1996-07-10  |  42KB  |  1,100 lines

  1. JB-LEARN - Version 1.2 - Copyright (C) 1995, Jeff Bishop - February 4, 1995
  2.  
  3. Introduction
  4.  
  5.      I have always loved writing {COMMO} macros.  After examining other
  6.      telecommunication programs to see what could be added to {COMMO} I came
  7.      up with the idea of writing a automatic learn macro for {COMMO}.
  8.  
  9.      The {COMMO} macro language is very complex.  Many users have
  10.      been scared of it due to this fact.  I thought to myself
  11.      "what could I do to make it easier".  I decided to write a
  12.      macro that would create {COMMO} macros for login activities
  13.      (or any activity the user wishes).  After weeks of work, JB
  14.      Learn was born to satisfy this requirement/need.
  15.  
  16. JB-Learn has the following features:
  17.  
  18.      -    A very solid learn engine to create ready-to-run macros
  19.           after learn mode is complete.
  20.  
  21.      -    A learn data file capacity to make future learning more
  22.           intelligent.  The learn macro learns as you use it.  This
  23.           is a first in the BBS community.  Find another learn
  24.           engine that can do that (except CS-LEARN for {COMMO}).
  25.           The user has complete control as to what it learns.
  26.  
  27.      -    The learn data file will process {COMMO} variables for
  28.           you.  This gives you even more power.  This allows for great
  29.           flexibility when using CS-MAC since it defines a wealth of
  30.           variables that you can use.
  31.  
  32.      -    Have complete control of your learning experience.  You
  33.           make the decisions if you want to.  This provides the
  34.           ability to correct mistakes that the learn can not
  35.           handle.  This provides the ability to create very solid
  36.           macros.  Just think, you tell the teacher what to do and get a
  37.           better grade for it.
  38.  
  39.      -    Automatic detection of front end mailers.  No need to
  40.           press <ESCAPE> twice any more (even during learning) as long as
  41.           EMSI protocol is being used.
  42.  
  43.      -    The learn can automatically try to log you in without
  44.           user intervention.  This is similar to most other
  45.           conventional learn engines available in other
  46.           communication programs.
  47.  
  48.      -    The ability to add SSLOOK logic in your macros. This will make them
  49.           more stream lined for those nagging prompts often seen on BBS's. 
  50.           Also added logic to allow for forwarding SSLOOKS  after each
  51.           LOOKFOR/SEND combination.  Define the SSLOOK once and use it over
  52.           and over again if need be.
  53.  
  54.      -    The macro is FREE for your use.  The source code is very
  55.           well commented for a great learning experience.
  56.  
  57. Contact Information
  58.  
  59.      I value all of your input.  Please contact me with any
  60.      suggestions you may have.  You can contact me via the following methods:
  61.  
  62.      Jeff Bishop
  63.      Mailing Address: 420 E Yavapai RD. NO. H Tucson, AZ 85705
  64.      E-Mail Address : JBISHOP@PRIMENET.COM (my PGP public key in MYPUBLIC.KEY)
  65.      Voice Phone    : 1-602-888-1456 (evenings before 12:00AM EST).
  66.  
  67.      I can also be reached in the COMMO conference in the fidonet and WME
  68.      message networks.  Post a message to "jeff bishop" and I will surely
  69.      respond to it.
  70.  
  71. Getting JB-Learn Updates
  72.  
  73.      JB-Learn is distributed in two different packages.  I am
  74.      distributing it as a stand alone package and it is also in the
  75.      CS-MAC package (version 13 and above).  If you are reading this from
  76.      the CS-MAC archive, this may or may not be the latest one.  Use the
  77.      information below to get the latest and greatest version.
  78.  
  79.      If you have access to the internet, you can use ftp to get JB Learn.
  80.      Ftp to ftp.primenet.com.  Login as anonymous and send your e-mail
  81.      address as the password.  Once logged in, cd to  /users/j/jbishop/commo.
  82.      Once here, get the file jbl-*.zip.  This will get you the latest
  83.      version. You are also welcome to get the latest version of CS-MAC
  84.      here as well. Get the file cs*.zip.
  85.  
  86.      If you wish, you can also ftp to ftp.nlbbs.com. Login as anonymous and
  87.      send your mail address as password. Once here, cd to /pub/cs-mac.
  88.  
  89.      If you do not have access to the internet, you can log in to the
  90.      Demodulator BBS.  The phone number is 1-602-290-2807.  Use 'COMMO RELEASE'
  91.      as your first and last name.  Use 'guest' as the password.  A menu will
  92.      be presented to allow you to pick JB-Learn from.
  93.  
  94. ==================================================
  95.  
  96. {:JB-LEARN}
  97.    This is the beginning of the macro.  Here is where basic setup is done to
  98.    prepare for learn operation.  Study this area carefuly and consult the
  99.    JB-LEARN.DOC file for further information about variables defined here.
  100.  
  101.    {NOCARRIER QUIT}
  102.    Quit learn if carrier is lost.
  103.  
  104.    {SETESCAPE-P0 ENT_LRN}{SETGET ,,L}
  105.    Define the label to go to when the <ESCAPE> key is pressed at the local
  106.    keyboard.  Make all keyboard input echo to the local terminal only.
  107.  
  108.    {SETVARIABLE AUTORESP,N}
  109.    This variable tells JB-LEARN whether or not to ask for confirmation of
  110.    each response found while reading the LEARN.DAT data file.
  111.    If it is set to 'Y', the macro will act in a true auto-learn mode.
  112.  
  113.    {SETVARIABLE DATAFILE,%_HOM%learn.dat}
  114.    This defines the data filename used.  The default is %_HOM%LEARN.DAT.
  115.  
  116.    {SETVARIABLE ESCAPE_2,~^[~^[}
  117.    Define a variable as 2 escapes.
  118.  
  119.    {SETVARIABLE CAPTFILE,%_HOM^(JBLRN^).CAP}
  120.    We are defining the name of the temporary capture file used throughout
  121.    this macro.
  122.  
  123.    {SETVARIABLE FON_FILE,%_HOM^(JBLRN^).FON}
  124.    We are defining the name of the temporary FON file used throughout this
  125.    macro.
  126.  
  127.    {SETVARIABLE NOV_MENU,Y}
  128.    Set JB-Learn menu in novice mode.
  129.  
  130.    {SETVARIABLE SLKLIMIT,15}{DECREMENT SLKLIMIT,1}
  131.    This defines the number of SSLOOK strings allowed. A default of 15 is
  132.    defined. Change this to 0 if you do not want any SSLOOK logic in your
  133.    macros.
  134.  
  135.    {SETVARIABLE SSLK_CNT,0}
  136.    Set the SSLOOK counter to 0.
  137.  
  138.    {SETVARIABLE SSLKAUTO,N}
  139.    Set this variable to Y if you want SSLOOKS to be automatically generated
  140.    instead of LOOKFOR/SEND pairs.  This is only going to happen in the area
  141.    that the data file is processed.  It will not affect the JB-Learn menu.
  142.  
  143.    {SETVARIABLE WAITTIME,10}
  144.    This variable defines the length of time after all modem
  145.    activity stops before the learn process starts interacting
  146.    with the user.  The default is 10 seconds.  Change the
  147.    definition if you would like.  Be careful though to keep it
  148.    long enough.  Making it too short will have disastrous
  149.    affects in the learn engine.  If this variable is set as NULL,
  150.    then this auto learn type feature is turned off.
  151.  
  152.    {CALL OPEN_CAP}
  153.    Open the capture file.
  154.  
  155. {:LEARNING}
  156.    This label begins the learning online process.
  157.  
  158.    We are now going to define the learn robot.
  159.  
  160.    {SETLOOK %WAITTIME}
  161.    This defines the setlook timer.
  162.  
  163.    {GOLOOK LEARNING,^M}
  164.    The look timer is continuously reset upon seeing a <ENTER>
  165.    character.  When it is seen, the macro jumps back to the LEARNING label.
  166.  
  167.    {SSLOOK ESCAPE_2,**EMSI_}
  168.    Watch for the EMSI protocol string. When it comes in, send two escapes.
  169.  
  170.    {LOOKFOR <ESC> FOR LEARN MODE}
  171.    Show a dummy lookfor and provide information to the user on the status line.
  172.  
  173. {:ENT_LRN}
  174.    Start parsing the BBS prompt now.
  175.  
  176.    {CAPTURE N}{WOPEN-A %CAPTFILE}{WRITE}{WCLOSE}
  177.    Turn off the capture file.  Open the capture file to write to (in append
  178.    mode).  Write a blank line to the file to insure that the capture file
  179.    ends with a CR/LF pair.  Close the capture file.
  180.  
  181.    {RCLOSE}{ROPEN %CAPTFILE,ERD}{SETVARIABLE T}{SETVARIABLE LOOK_FOR}
  182.    Open the capture file for reading.  Once the capture file has
  183.    been read completely, go to the label ERD.  Clear the variables used
  184.    during the read loop below.
  185.  
  186. {:RDL}
  187.    Enter the capture file read loop to find the BBS prompt.
  188.  
  189.    {READ T}{COMPARE T}{IFCONDITION RDL}
  190.    Read a line from the file.  If the line is blank, go get another one.
  191.  
  192.    {SETVARIABLE LOOK_FOR,%T}{GOTO RDL}
  193.    Set the LOOK_FOR variable to the line read and go get another line from
  194.    the file.
  195.  
  196. {:ERD}
  197.    End of file read label definition.
  198.  
  199.    {COMPARE LOOK_FOR}{IFCONDITION ,JBLRNDAT}
  200.    We are checking to see if we have found a BBS prompt.  If we
  201.    have, then control passes to parse the data file.  Otherwise, we will now
  202.    ask the user to supply a look_for string (BBS prompt).
  203.  
  204.    {CLEAR}{DISPLAY 1,1,,ENTER THE STRING TO LOOK FOR (BBS PROMPT): }
  205.    {GETSTRING-I LOOK_FOR,32}
  206.    Clear the screen and ask the user to supply a BBS prompt.
  207.  
  208.    {COMPARE LOOK_FOR}{IFCONDITION QUIT}
  209.    See if the user entered a BBS prompt.  If they did not, leave the learn
  210.    macro.
  211.  
  212. {:JBLRNDAT}
  213.    This is the label used to designate processing of the data file.
  214.  
  215.    {SUBSTRING LOOK_FOR,-32,32,%LOOK_FOR}
  216.    Grab the last 32 characters of the BBS prompt as the target string.
  217.  
  218.    {COMPARE LRN_MAC}{IFCONDITION ,LOAD_DAT}
  219.    If the macro file has already been defined process the data file.
  220.  
  221.    We are now beginning to define the name of the macro file to write to
  222.    during learn operation.
  223.  
  224.    {SETVARIABLE LRN_MAC,%_MAC}
  225.    We will first set the name of the macro file to the current {COMMO} macro
  226.    file name.  The user may change it later.
  227.  
  228. {:DEF_MAC}
  229.    The macro entry loop.
  230.  
  231.    {KEYSTUFF 4700}{INPUT LRN_MAC,ENTER MACRO FILE TO APPEND TO}
  232.    Stuff a HOME key into the keyboard buffer.  This will force
  233.    the cursor at the beginning of the line of the input window. Allow the user
  234.    to edit the macro name if need be.
  235.  
  236.    {COMPARE LRN_MAC}{IFCONDITION DEF_MAC}
  237.    Check and see if the macro is NULL.  If it is, go back and re-enter it.
  238.  
  239. {:DEF_LBL}
  240.    We are now going to define the label to be used for this learned macro
  241.    entry.
  242.  
  243.    {SETVARIABLE LRN_LBL,%_NAM}
  244.    {KEYSTUFF 4700}{INPUT LRN_LBL,ENTER LABEL NAME USED FOR THIS MACRO}
  245.    Stuff a HOME key into the keyboard buffer.  This will force the cursor at
  246.    the beginning of the line of the input window.  Allow the user to edit the
  247.    label name.
  248.  
  249.    {COMPARE LRN_LBL}{IFCONDITION DEF_LBL}
  250.    Check and see if the label is NULL.  If it is, go back and re-enter it.
  251.  
  252.    This is the start of a routine to remove invalid characters from the label
  253.    name.  The characters we will remove are the comma, space, colon, slash,
  254.    and curly braces
  255.  
  256.    {SETVARIABLE I,, :/^(^)}{SETVARIABLE COUNT,0}{SETVARIABLE T}
  257.    This sets the invalid characters that will be stripped from the system name
  258.    to make the label name.  Initialize a counter that will be used to step
  259.    through the system name character by character.
  260.  
  261. {:XLATE_LOOP}
  262.    This is the loop that checks each character and removes invalid
  263.    characters.
  264.  
  265.    {INCREMENT COUNT,1}
  266.    Increment the placekeeper that checks each character in the system name.
  267.  
  268.    {SUBSTRING CH,%COUNT,1,%LRN_LBL}
  269.    This takes a character out of the label name and puts it in variable %CH.
  270.  
  271.    {COMPARE CH}{IFCONDITION XLATE_DONE}
  272.    This is checking for the end of the label name.  If we have
  273.    reached the end, the variable %CH will be empty.  If the variable %CH was
  274.    empty, we are done.  Otherwise, continue to see if this is an invalid
  275.    character.
  276.  
  277.    {INSTRING I,%CH}{IFCONDITION XLATE_LOOP}
  278.    Check to see if this character is in the invalid list.  If it is in the
  279.    invalid list, loop back.  If this character is not on the invalid list,
  280.    it will be added to the label.
  281.  
  282.    {SETVARIABLE T,%T%%CH}
  283.    The act of sticking two variables back-to-back like this is called
  284.    "concatenating".  Variable %LRN_LBL will keep growing until the end of the
  285.    system name is reached.
  286.  
  287.    {LENGTH %T}{COMPARE _LEN,8}{IFCONDITION-E ,XLATE_LOOP}
  288.    This gets the length of the %LRN_LBL string and puts it into %_LEN The
  289.    length of the string is compared with the value "8".  If the length of the
  290.    label = 8, the routine will go to the next step.  If %_LEN does not = 8,
  291.    the routine will return to the top of the loop to get the next character.
  292.  
  293. {:XLATE_DONE}
  294.    Finish processing label definition.
  295.  
  296.    {SETVARIABLE LRN_LBL,%T}{SETVARIABLE COUNT}{SETVARIABLE T}
  297.    {COMPARE LRN_LBL}{IFCONDITION DEF_LBL}
  298.    {INFORM-D1 THE LABEL BEING USED IS: %LRN_LBL ...}
  299.    Check and see if the label is NULL.  If it is, go back and re-enter it.
  300.  
  301.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE}{WRITE ^(:%LRN_LBL^)}
  302.    Open the macro file and write a blank line to it.  Write the label in the
  303.    macro file now.
  304.  
  305.    {WRITE ^(SETVARIABLE ESCAPE_2,~^[~^[^)}
  306.    Write a variable definition to the macro as 2 escapes.
  307.  
  308.    {WRITE ^(SSLOOK ESCAPE_2,**EMSI_^)}{WRITE}{WCLOSE}{INCREMENT SSLK_CNT,1}
  309.    Some BBS programs use a front end mailer.  These front end mailers ask the
  310.    user to press <ESCAPE> twice to enter the BBS.  This line automatically
  311.    senses these front end mailers and will send the <ESCAPE> characters for
  312.    you.  After writing is done, close the file.  Increment the SSLK_CNT
  313.    counter variable showing that a SSLOOK has been defined.
  314.  
  315.    {CLEAR}{DISPLAY 1,1,,DO YOU WANT TO USE AUTO-LEARN MODE (Y/N) [N]? }
  316.    {GETSTRING-HI AUTORESP,1}{CLEAR}
  317.    Clear the screen.  Ask the user if they want to use auto-learn mode.
  318.    The only way this feature is turned on is if AUTORESP is set to 'Y'.
  319.  
  320. {:LOAD_DAT}
  321.    Check and see if the BBS prompt has already been seen. If so, generate
  322.    the response automatically. Otherwise, begin loading the data file.
  323.  
  324.    {COMPARE SLKLIMIT,0}{IFCONDITION-E LOADDAT1}{SETVARIABLE COUNT,0}
  325.    Initialize the counter to 0
  326.  
  327. {:CHK_SLOP}
  328.  
  329.    {INCREMENT COUNT,1}
  330.    Increment the counter.
  331.  
  332.    {COMPARE SLR_%COUNT}{IFCONDITION LOADDAT1}{SETVARIABLE-s RESP,SLR_%COUNT}
  333.    See if no response is available. If there is not one, end this routine.
  334.  
  335.    {INSTRING SLT_%COUNT,%LOOK_FOR}{IFCONDITION ,CHK_SLOP}
  336.    Check and see if this target matches the BBS prompt found. If it does,
  337.    process it. If it is not, go get another SSLOOK variable.
  338.  
  339.    {COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L ,L_DAT2}
  340.  
  341. {:L_DAT1}
  342.  
  343.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SSLOOK SLR_%COUNT,%LOOK_FOR^)}{WRITE}
  344.    {WCLOSE}{INCREMENT SSLK_CNT,1}{GOTO L_DAT3}
  345.  
  346. {:L_DAT2}
  347.  
  348.    {WOPEN-A %_HOM%%LRN_MAC}
  349.    {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %resp^)}{WRITE}{WCLOSE}
  350.    {call bringfwd}
  351.  
  352. {:L_DAT3}
  353.  
  354.    {INFORM-D1 AUTOMATIC RESPONSE BEING GENERATED ...}{SEND %RESP}
  355.    {GOTO CLN_QUIT}
  356.  
  357. {:LOADDAT1}
  358.  
  359.    {SETVARIABLE COUNT}{SETVARIABLE RESP}{SETVARIABLE T}
  360.    {IFEXIST %DATAFILE,OPENDATA}
  361.    If the data file does exist, process it. If it does not, ask the user
  362.    to supply the name of the data file.
  363.  
  364.    {KEYSTUFF 4700}
  365.    Stuff a HOME key into the keyboard buffer.  This will force
  366.    the cursor at the beginning of the line of the input window.
  367.  
  368.    {INPUT DATAFILE,ENTER NAME OF LEARN DATA FILE (LEAVE BLANK TO IGNORE IT):}
  369.    Ask the user for the name of the data file.
  370.  
  371.    {COMPARE DATAFILE}{IFCONDITION MENU}{IFEXIST %DATAFILE,,LOAD_DAT}
  372.    See if the variable is blank. If it is, jump to the learn menu. If it
  373.    is not, process the newly entered value again.
  374.  
  375. {:OPENDATA}
  376.    This is where the data file is opened.
  377.  
  378.    {RCLOSE}{ROPEN %DATAFILE,DATA_EOF}
  379.    Open the data file for reading.
  380.  
  381. {:DAT_LOOP}
  382.    Here is where the data file loop begins.
  383.  
  384.    {SETVARIABLE POS}{SETVARIABLE T}{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
  385.    Clear all variables used in the loop.
  386.  
  387.    {READ T}{COMPARE T}{IFCONDITION DAT_LOOP}
  388.    Read a line from the DAT file.
  389.  
  390.    {SUBSTRING POS,1,1,%T}{COMPARE POS, }{IFCONDITION DAT_LOOP}
  391.    Check to see if the line read is blank.  If it is, go get another.  Check
  392.    and see if the first character in the line is a space.  If it is, get
  393.    another line.
  394.  
  395.    {INSTRING T,,}{IFCONDITION ,DAT_LOOP}
  396.    Check and see if the line read as a target/response match.  If it is not,
  397.    go get another.
  398.  
  399.    {SETVARIABLE POS,%_POS}{INCREMENT POS,1}
  400.    Set the position found to POS.  Increment the position variable by 1.
  401.  
  402.    {SUBSTRING TARGET,%POS,255,%T}
  403.    Get the target string from the line read from the data file.
  404.  
  405.    {COMPARE TARGET}{IFCONDITION DAT_LOOP}
  406.    Check and see if the target is blank.  If it is, get another line from the
  407.    data file.
  408.  
  409.    {INSTRING LOOK_FOR,%TARGET}{IFCONDITION ,DAT_LOOP}
  410.    Look to see if this defined target exists in the BBS prompt defined
  411.    earlier.  Check and see if this target matches anything in the BBS prompt.   If it does not, processing returns for another line
  412.    out of the data file.
  413.  
  414.    {DECREMENT POS,2}{SUBSTRING RESPONSE,1,%POS,%T}
  415.    Decrement the position variable defined earlier by 2.  Get the response
  416.    string from the data out of the data file.
  417.  
  418.    {COMPARE RESPONSE}{IFCONDITION DAT_LOOP}{RCLOSE}
  419.    Close the data file.
  420.  
  421. {:DATA_EOF}
  422.    This label is the label used after the data file is closed.
  423.  
  424.    {COMPARE RESPONSE}{IFCONDITION MENU}
  425.    See if the response is blank.  If it is, jump to the learn menu.
  426.  
  427.    {SUBSTRING T,1,1,%RESPONSE}
  428.    Look at the first character of the response.
  429.  
  430.    {COMPARE T,%%}{IFCONDITION ,CONFGUES}
  431.    Is the first character of the response a "%"?  Notice using two %'s in
  432.    order to represent a literal "%".  If the first character of the RESPONSE
  433.    indicates that it is a {Commo} variable, we will proceed to translate the
  434.    variable into it's literal expression.  For example, %NAME will be
  435.    converted to "Jeff Bishop".  If the first character of the RESPONSE isn't a
  436.    "%", jump to the menu that asks you to confirm the response before sending
  437.    it.  That menu is located at label :CONFGUES.
  438.  
  439.    {SUBSTRING RESPONSE,2,200,%RESPONSE}
  440.    The first step in the translation is to strip off the leading "%"
  441.    character.  Notice that this command substrings a variable back into itself.
  442.  
  443.    {INSTRING RESPONSE,|}{IFCONDITION-C STRIP-PIPE}
  444.    The next step is to check the response variable for presence
  445.    of a "pipe" character.  The macro assumes that the pipe would
  446.    only appear as the last character of a response.  If the response
  447.    variable has a pipe character in it, we are going to call a routine to
  448.    strip it off.  Otherwise, we will continue on our translation journey
  449.    directly.  To make the IFCONDITION function perform a "call", the "-C"
  450.    switch is used.  If we strip off the "pipe", we will add it back on
  451.    after performing the translation step.
  452.  
  453.    {SETVARIABLE-S T,%RESPONSE}
  454.    This single step translates the variable name into the
  455.    contents of the variable name.  Fred Brucker's explanation
  456.    in MACRO.DOC is very good (hint to read the docs).
  457.  
  458.    Basically, this is a two step setvariable function.  Step one
  459.    expands the %response to make this example command
  460.    Step 1   (setvariable t,%name)       ;%t=name
  461.    Step 2   performs the above command  ;%t=Jeff Bishop
  462.  
  463.    {COMPARE T}{IFCONDITION-C N_VARDEF}
  464.    Now checking if you have %name (for example) defined.  If
  465.    you haven't defined a variable in Commospace, %T will now
  466.    be NUL.  This would be a disaster to the continuation
  467.    of the learn macro.  If the response is NUL, we are going to call a
  468.    routine to ask you to define it.  Otherwise, we will proceed with the
  469.    translation.
  470.  
  471.    {SETVARIABLE RESPONSE,%T}
  472.    This command moves the contents of %T into %RESPONSE, and we are
  473.    assured that %T is not NUL ... therefore %RESPONSE is not NUL.
  474.  
  475.    {COMPARE STRIPT}{IFCONDITION CONFGUES}
  476.    Now checking if we earlier made a trip to the routine that
  477.    strips off a trailing "pipe" character.  If %stript is NUL,
  478.    it means we didn't make the trip to :STRIP-PIPE.  If %stript is NUL,
  479.    meaning we didn't strip off a trailing "pipe", then jump to the routine
  480.    that asks you to confirm the response before it is sent.  Translation is
  481.    complete.  If %stript contains a value, it means that we DID make a trip
  482.    to the :STRIP-PIPE routine.  If that is the case, our translation isn't
  483.    complete yet, we have to add the "pipe" back onto the response.
  484.  
  485.    {SETVARIABLE RESPONSE,%RESPONSE|}{SETVARIABLE STRIPT}{GOTO CONFGUES}
  486.    This simply puts the "pipe" character back on the translated
  487.    variable (turning %name| into Jeff Bishop|).  This clears the variable
  488.    that was used to indicate that we had made a call to :STRIP-PIPE.
  489.    Translation is complete.  Go to the routine that asks you to
  490.    confirm the response before it is sent.
  491.  
  492. {:STRIP-PIPE}
  493.    This label is the start of a routine to remove a trailing "|"
  494.    from a variable.  The command that happened just before coming
  495.    here was (instring response,|).  We are here because the
  496.    answer to that was "YES", there IS a "pipe" in %RESPONSE.
  497.  
  498.    {SETVARIABLE LEN,%_POS}
  499.    This puts the position of the "|" (given by the instring
  500.    function as %_pos) into %len.  Commo does not provide for
  501.    tampering with the %_pos variable.
  502.  
  503.    {DECREMENT LEN,1}{SETVARIABLE STRIPT,Y}{RETURN}
  504.    {SUBSTRING RESPONSE,1,%LEN,%RESPONSE}
  505.    These two commands strip the last character from the
  506.    %RESPONSE variable, in this case we have stripped a "|".  This sets a
  507.    variable that we will later use to replace the character that we stripped
  508.    off with this routine.  This is the end of the :STRIP-PIPE subroutine.
  509.    Return to the place called from.
  510.  
  511. {:N_VARDEF}
  512.    This label is the start of a routine that prompts you for a
  513.    setting for a variable.  This routine is called when a
  514.    variable appears in the LEARN.DAT file and that variable
  515.    isn't found in the currently defined Commo variables.
  516.    Typically, these variables would be %name and %_pas.
  517.  
  518.    {CLEAR}{DISPLAY 1,1,,Input a value for %%%response: }
  519.    The first two % signs cause a % to be displayed.  The third
  520.    one causes %response to be displayed as its value.
  521.    An example result .... "Input a value for %name: "
  522.  
  523.    {GETSTRING-I %%RESPONSE}
  524.    This simple looking command is a very powerful command.
  525.    Notice that there are two % signs.  This means, in this
  526.    example, that we are getting a value for %name.  The "-I"
  527.    switch restricts input to the keyboard, if the host system
  528.    sends anything, it will be ignored.
  529.  
  530.    {COMPARE %%RESPONSE}{IFCONDITION N_VARDEF}
  531.    Checking to make sure that you have put a value in for this
  532.    variable.  Have you a value for %name?  If %%response (in example, %name)
  533.    is NUL, repeat the routine until you put in a value.
  534.  
  535.    {SETVARIABLE-S T,%RESPONSE}{RETURN}
  536.    This is similar to the command that was used in the primary
  537.    translation routine.  By example, it first "expands" %response
  538.    to %name, then it sets %T=contents of %name.  This is the end of the
  539.    routine that asks you to define a variable.  This label marks the end of
  540.    reading the data file and making any necessary variable translations.
  541.  
  542. {:CONFGUES}
  543.    This is the start of a menu that asks you to confirm your response to
  544.    this BBS prompt.
  545.  
  546.    {COMPARE AUTORESP,Y}{IFCONDITION RITERESP}
  547.    See if the user does not want to get prompted.
  548.  
  549.    {CLEAR}{DISPLAY 1,1,,BBS PROMPT: %LOOK_FOR}
  550.    Clear the screen and show the BBS prompt.
  551.  
  552.    {COMPARE RESPONSE,%_PAS|}{IFCONDITION ,C_GUESS1}
  553.    {DISPLAY 2,1,,RESPONSE STRING : ^(PASSWORD^)}{GOTO GUESSCHK}
  554.  
  555. {:C_GUESS1}
  556.  
  557.    {DISPLAY 2,1,,RESPONSE STRING : %RESPONSE}
  558.  
  559. {:GUESSCHK}
  560.  
  561.    {DISPLAY 4,1,,IS THIS RESPONSE CORRECT (Y/N) [N]? }
  562.    Display the response and target strings and ask if the
  563.    response is correct.
  564.  
  565.    {GETSTRING-HI KEY,1,MENU}
  566.    Get keyboard input.  If the user presses <ENTER> controls passes to the
  567.    learn menu.
  568.  
  569.    {COMPARE KEY,Y}{IFCONDITION ,MENU}
  570.    If the user presses N control will pass to the learn menu.
  571.  
  572.    {COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L ,RITERESP}
  573.    {COMPARE SSLKAUTO,Y}{IFCONDITION RITESSLK}
  574.    See if the SSLOOK count is less than SLKLIMIT. If it is, continue. If it
  575.    is not, bypass SSLOOK logic.
  576.  
  577.    {CLEAR}
  578.    {DISPLAY 1,1,,DEFINE THIS AS A SSLOOK STRING COMBINATION (Y/N) [N]? }
  579.    {GETSTRING-HI KEY,1,RITERESP}
  580.    Get keyboard input.  If the user presses <ENTER> controls passes to the
  581.    normal LOOKFOR/SEND macro method.
  582.  
  583.    {COMPARE KEY,Y}{IFCONDITION ,RITERESP}
  584.    If the user presses N control will pass to the LOOKFOR/SEND macro logic.
  585.  
  586. {:RITESSLK}
  587.  
  588.    {INCREMENT SSLK_CNT,1}
  589.    Increment the SSLOOK counter.
  590.  
  591.    {SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
  592.    {SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
  593.    Build the SSLOOK strings.
  594.  
  595.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
  596.    {WRITE ^(SSLOOK SLR_%SSLK_CNT,%LOOK_FOR^)}{WRITE}{WCLOSE}{CLEAR}
  597.    {DISPLAY 1,1,,BRING THIS SSLOOK STRING COMBO FORWARD AFTER ALL LOOKFOR/SEND PAIRS (Y/N) [N]? }
  598.    {GETSTRING-HI KEY,1}{SETVARIABLE SLF_%SSLK_CNT,%KEY}{GOTO RITEDONE}
  599.    Write the variable definition and the SSLOOK to the macro file. Continue
  600.    macro execution.
  601.  
  602. {:RITERESP}
  603.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}
  604.    {WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}{call bringfwd}
  605.    Open the macro file.  Write the commands to it.  After doing
  606.    so, close the macro file. Reset the SSLOOK counter to 0.
  607.  
  608. {:RITEDONE}
  609.  
  610.    {COMPARE T,%%_PAS}{IFCONDITION ,GUES_END}
  611.    {PASSWORD}{SEND |}{GOTO CLN_QUIT}
  612.  
  613. {:GUES_END}
  614.  
  615.    {SEND %RESPONSE}{GOTO CLN_QUIT}
  616.    Send the response string now.  Clean up now.
  617.  
  618. {:MENU}
  619.    This label begins the learn menu.
  620.  
  621.    {CLEAR}{COMPARE NOV_MENU,Y}{IFCONDITION ,MENU1}
  622.    {DISPLAY 1,1,,JB-LEARN RESPONSE TYPE MENU - VERSION 1.2}
  623.    {DISPLAY 2,1,,BBS PROMPT: %LOOK_FOR}
  624.    {DISPLAY 4,1,,C - CONTINUE LEARNING}
  625.    {DISPLAY 6,1,,E - SEND <ENTER>}
  626.    {DISPLAY 8,1,,H - TREAT AS A SINGLE KEY HOT KEY (NO <CR>)}
  627.    {DISPLAY 10,1,,I - INSERT COMMENT INTO MACRO}
  628.    {DISPLAY 12,1,,L - TREAT AS A SSLOOK STRING: (SSLOOK COUNT %SSLK_CNT)}
  629.    {DISPLAY 14,1,,P - TREAT AS A PASSWORD}
  630.    {DISPLAY 16,1,,Q - QUIT JB-LEARN}
  631.    {DISPLAY 18,1,,R - REVISE/EDIT BBS PROMPT}
  632.    {DISPLAY 20,1,,S - ENTER STANDARD BBS RESPONSE (WITH <CR>)}
  633.    {DISPLAY 22,1,,W - SET WAIT TIME: %WAITTIME}
  634.    {DISPLAY 23,1,,X - TOGGLE BETWEEN NOVICE AND EXPERT MENU}
  635.    {DISPLAY 24,1,,ENTER CHOICE: C,E,H,I,L,P,Q,R,S,W,X: }{GOTO MENU2}
  636.    Clear the screen and display the menu.
  637.  
  638. {:MENU1}
  639.    {DISPLAY 1,1,,ENTER CHOICE: C,E,H,I,L,P,Q,R,S,W,X: }
  640.  
  641. {:MENU2}
  642.    {GETSTRING-HI KEY,1,MENU}
  643.    Prompt for keyboard input.  If <ENTER> is pressed by itself,
  644.    control passes to the label shown at the end of the line.
  645.  
  646.    {COMPARE KEY,C}{IFCONDITION CLN_QUIT}
  647.    {COMPARE KEY,E}{IFCONDITION JBL_SNCR}
  648.    {COMPARE KEY,H}{IFCONDITION JBL_HKEY}
  649.    {COMPARE KEY,I}{IFCONDITION INS_CMNT}
  650.    {COMPARE KEY,L}{IFCONDITION ,MENU3}
  651.    {COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L D_SSLOOK,MENU}
  652. {:MENU3}
  653.    {COMPARE KEY,P}{IFCONDITION JBL_PASS}
  654.    {COMPARE KEY,Q}{IFCONDITION QUIT}
  655.    {COMPARE KEY,R}{IFCONDITION EDITBPMT}
  656.    {COMPARE KEY,S}{IFCONDITION JBL_STD}
  657.    {COMPARE KEY,W}{IFCONDITION WAITTIME}
  658.    {COMPARE KEY,X}{IFCONDITION ,MENU}
  659.    {COMPARE NOV_MENU,Y}{IFCONDITION MENU4}{SETVARIABLE NOV_MENU,Y}{GOTO MENU}
  660. {:MENU4}
  661.    {SETVARIABLE NOV_MENU,N}
  662.  
  663.    Check for each option on the menu to see if the user
  664.    selected it and branch accordingly.
  665.  
  666.    {GOTO MENU}
  667.    None of the options matched the key pressed, re-display the
  668.    menu.
  669.  
  670. {:JBL_SNCR}
  671.    Send <ENTER> label.
  672.  
  673.    {WOPEN-A %_HOM%%LRN_MAC}
  674.    {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND |^)}{WRITE}{WCLOSE}
  675.    {call bringfwd}{SEND |}{SETVARIABLE RESPONSE,|}{GOTO CLEAN_UP}
  676.    Open the macro file.  Write the command to look for the BBS
  677.    prompt followed by a command to send the <ENTER> key.  The
  678.    file is then closed.  Send the <ENTER> out to the BBS now and clean up
  679.    after that.
  680.  
  681. {:JBL_HKEY}
  682.    Process hot key entries.
  683.  
  684.    {CLEAR}{DISPLAY 1,1,,ENTER THE KEY TO SEND TO THE HOST: }
  685.    Clear the screen and prompt the user for a key.
  686.  
  687.    {GETSTRING-HI KEY,1,MENU}
  688.    Get keyboard input.  If the user presses <ENTER>, then
  689.    control passes back to the main learn menu.
  690.  
  691.    {WOPEN-A %_HOM%%LRN_MAC}
  692.    {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %KEY^)}{WRITE}{WCLOSE}
  693.    Open the macro file and write the two commands to the file.
  694.    Close the file.
  695.  
  696.    {SEND %KEY}{SETVARIABLE RESPONSE,%KEY}{call bringfwd}{GOTO CLEAN_UP}
  697.    Send the key to the BBS and clean up after it.
  698.  
  699. {:INS_CMNT}
  700.    Insert comment into macro file.
  701.  
  702.    {INPUT T,ENTER A COMMENT TO PLACE INTO THE MACRO FILE: }
  703.    Prompt the user for a comment.
  704.  
  705.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE}{WRITE %T}{WRITE}{WCLOSE}
  706.    Open the macro file and write the comment to the file.
  707.    Close the file.
  708.  
  709.    {SETVARIABLE T}{GOTO CLN_QUIT}
  710.  
  711. {:D_SSLOOK}
  712.    Define a SSLOOK definition for the macro.
  713.  
  714.    {SETVARIABLE RESPONSE}{INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
  715.    Ask the user to enter a string.
  716.  
  717.    {CLEAR}{DISPLAY 1,1,,DO YOU WANT A <CR> SENT WITH THIS STRING (Y/N) [N]? }
  718.    {GETSTRING-HI CH,1,SSLKCONT}
  719.    Ask the user if he/she would like to have a <CR> attached to the entered
  720.    string.
  721.  
  722.    {COMPARE CH,Y}{IFCONDITION ,SSLKCONT}
  723.    Check and see if the answer is 'Y'. If it is not, skip adding the <CR>.
  724.  
  725.    {SETVARIABLE RESPONSE,%RESPONSE|}
  726.    Add the <CR> to the response.
  727.  
  728. {:SSLKCONT}
  729.  
  730.    {COMPARE RESPONSE}{IFCONDITION ,SSLKCON1}
  731.    If the user enters no data, return to the menu.
  732.  
  733.    {INFORM-D1 NO RESPONSE ENTERED - RETURNING TO LEARN MENU ...}{GOTO MENU}
  734.  
  735. {:SSLKCON1}
  736.  
  737.    {INCREMENT SSLK_CNT,1}
  738.    Increment the SSLOOK counter.
  739.  
  740.    {SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
  741.    {SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
  742.    Build the SSLOOK strings.
  743.  
  744.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
  745.    {WRITE ^(SSLOOK SLR_%SSLK_CNT,%look_for^)}{WRITE}{WCLOSE}{CLEAR}
  746.    {DISPLAY 1,1,,BRING THIS SSLOOK STRING COMBO FORWARD AFTER ALL LOOKFOR/SEND PAIRS (Y/N) [N]? }
  747.    {GETSTRING-HI KEY,1}{SETVARIABLE SLF_%SSLK_CNT,%KEY}
  748.    Write the variable definition and the SSLOOK to the macro file.
  749.  
  750.    {SEND %RESPONSE}{SETVARIABLE CH}{SETVARIABLE RESPONSE}{CLEAR}{GOTO CLN_QUIT}
  751.    Send the string to the system and clear variables. Begin learning again
  752.    after doing that.
  753.  
  754. {:JBL_PASS}
  755.    Process as a password.
  756.  
  757.    {COMPARE _PAS}{IFCONDITION ,PASS1}
  758.    Check and see if the password has been defined from the dialing directory.
  759.    If it has, jump to the label shown.  Otherwise, we need to enter one.
  760.  
  761.    {CLEAR}{DISPLAY 1,1,,ENTER YOUR PASSWORD: }
  762.    Clear the screen and prompt the user for a password.
  763.  
  764.    {GETSTRING-IP RESPONSE,,MENU}
  765.    Get keyboard input.  If the user just presses <ENTER>, then
  766.    control passes back to the menu.
  767.  
  768.    {SETVARIABLE T,^(SEND %RESPONSE|^)}{GOTO JBL_PCNT}
  769.    Jump to this label.
  770.  
  771. {:PASS1}
  772.    Set password from dialing directory.
  773.  
  774.    {SETVARIABLE T,^(PASSWORD^) ^(SEND |^)}
  775.  
  776. {:JBL_PCNT}
  777.    Process password in macro file and send it out to the BBS.
  778.  
  779.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE %T}{WRITE}
  780.    {WCLOSE}
  781.    Open the macro file.  Write the command strings to the macro.  Close the
  782.    macro file.
  783.  
  784.    {call bringfwd}{COMPARE _PAS}{IFCONDITION JBLPCNT2}{PASSWORD}{SEND |}
  785.    {GOTO CLN_QUIT}
  786.  
  787. {:JBLPCNT2}
  788.  
  789.    {SEND %RESPONSE|}{GOTO CLN_QUIT}
  790.    Send the password out to the BBS.  Clean up after it.
  791.  
  792. {:JBL_STD}
  793.    Process standard BBS response (with <ENTER> at end).
  794.  
  795.    {SETVARIABLE RESPONSE}{INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
  796.    Ask the user to enter a string.
  797.  
  798.    {COMPARE RESPONSE}{IFCONDITION MENU}
  799.    If the user enters no data, return to the menu.
  800.  
  801.    {setvariable response,%response|}
  802.    Add a <CR> to the response.
  803.  
  804.    {WOPEN-A %_HOM%%LRN_MAC}
  805.    {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}
  806.    Open the macro file.  Write the command strings to it and  close the macro
  807.    file.
  808.  
  809.    {call bringfwd}{SEND %RESPONSE}{GOTO CLEAN_UP}
  810.    Send the entered string to the BBS.  Clean up now.
  811.  
  812. {:EDITBPMT}
  813.    Edit BBS prompt.
  814.  
  815.    {KEYSTUFF 4700}{INPUT LOOK_FOR,ENTER/EDIT THE BBS PROMPT}
  816.    Stuff a HOME key into the keyboard buffer.  This will force
  817.    the cursor at the beginning of the line of the input window. Allow the user
  818.    to edit the BBS prompt found.
  819.  
  820.    {COMPARE LOOK_FOR}{IFCONDITION QUIT}{GOTO MENU}
  821.    If the BBS prompt is blank, leave JB-learn macro. Return to the menu.
  822.  
  823. {:OPEN_CAP}
  824.    Open capture file.
  825.  
  826.    {EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
  827.    Check and see if the capture file exists.  If it does, delete it.
  828.  
  829.    {CAPMODE FILTER}{CAPTURE Y,%CAPTFILE}{RETURN}
  830.    Set the capture mode to filter.  Open the capture file and return.
  831.  
  832. {:WAITTIME}
  833.    Wait timeout entry.
  834.  
  835.    {KEYSTUFF 4700}
  836.    Stuff a HOME key into the keyboard buffer.  This will force
  837.    the cursor at the beginning of the line of the input window.
  838.  
  839.    {INPUT WAITTIME,ENTER THE NUMBER OF SECONDS TO WAIT UNTIL MENU?}{GOTO MENU}
  840.  
  841. {:CLEAN_UP}
  842.    The clean up routine.
  843.  
  844.    {SETVARIABLE KEY}{CLEAR}
  845.    {DISPLAY 1,1,,ADD THIS RESPONSE/TARGET COMBO TO THE DATA FILE (Y/N) [N]? }
  846.    Clear the screen and ask the user if he/she would like to add this
  847.    response/target to the data file.
  848.  
  849.    {getstring-hi key,1,CLN_QUIT}
  850.    Get keyboard input
  851.  
  852.    {compare key,Y}{ifcondition ,cln_quit}
  853.    If the user answers Y the append will happen. If they do not the quit will
  854.    continue without writing to the data file.
  855.  
  856.    {WOPEN-A %DATAFILE}{WRITE %RESPONSE,%LOOK_FOR}{WCLOSE}
  857.    Write the new response/BBS prompt combination to the data file.
  858.  
  859. {:CLN_QUIT}
  860.  
  861.    {CALL OPEN_CAP}{GOTO LEARNING}
  862.    Open the capture file and return to learn mode.
  863.  
  864. {:ADD_FON}
  865.    Add dialing directory entry to dialing directory for new learn macro.
  866.  
  867.    {CLEAR}{DISPLAY 1,1,,ADD A NEW ENTRY TO YOUR DIALING DIRECTORY (Y/N) [N]? }
  868.    {GETSTRING-HI KEY,1}
  869.    Ask the user if they would like to add a new dialing directory entry.
  870.  
  871.    {COMPARE KEY,Y}{IFCONDITION ,RETURN}
  872.    Check and see if the user wishes to do this.  If not, quit the adding
  873.    routine.
  874.  
  875.    {SETVARIABLE CH,%_NAM}
  876.    Set the variable to the system name (if known) by COMMO.
  877.  
  878.    {COMPARE CH}{IFCONDITION ,GETNAM1}
  879.    See if the system name is known now.
  880.  
  881.    {SETVARIABLE CH,%LRN_LBL}
  882.    Set the system name to the value defined for the label in the macro file
  883.    written during learn mode.
  884.  
  885. {:GETNAM1}
  886.  
  887.    {KEYSTUFF 4700}
  888.    Stuff a HOME key into the keyboard buffer.  This will force
  889.    the cursor at the beginning of the line of the input window.
  890.  
  891.    {INPUT CH,ENTER THE SYSTEM NAME FOR YOUR DIALING DIRECTORY ENTRY: }
  892.    Make the user verify their system name before continuing
  893.  
  894.    {COMPARE CH}{IFCONDITION RETURN}
  895.    See if the user left the system name blank.  If he/she did then exit add.
  896.  
  897.    {SETVARIABLE F,%CH (WITH LEARN) %_MON/%_DAY/%_YEA ^(}
  898.    Start building the dialing directory entry string here.
  899.  
  900. {:GETNUM0}
  901.    This label denotes the beginning of processing the phone number to be
  902.    dialed.
  903.  
  904.    {SETVARIABLE T,%_NUM}
  905.    Set the variable to the value known by COMMO's internal variable.
  906.  
  907.    {KEYSTUFF 4700}{INPUT T,ENTER THE SYSTEM'S PHONE NUMBER: }
  908.    Stuff a HOME key into the keyboard buffer.  This will force the cursor at
  909.    the beginning of the line of the input window. Ask the user to confirm the
  910.    phone number.
  911.  
  912.    {COMPARE T}{IFCONDITION GETNUM0}
  913.    If the phone number is blank (or edited blank), ask for the number again.
  914.  
  915.    {SETVARIABLE F,%F%%T^) ^(}
  916.    Continue building the dialing directory entry string.
  917.  
  918. {:GETPAS0}
  919.    We are now going to process the password.
  920.  
  921.    {COMPARE _PAS}{IFCONDITION GETPAS1}
  922.    See if the password is defined from a linked dialing directory entry.
  923.    If it is not, we will get a password from the user.
  924.  
  925.    {SETVARIABLE F,%F%%_PAS^) ^(}{GOTO ADD_MACRO}
  926.    Add the password to the dialing directory entry since we know the
  927.    password.  Jump to process the macro piece of the dialing directory entry.
  928.  
  929. {:GETPAS1}
  930.    This label begins asking the user for a password.
  931.  
  932.    {CLEAR}{DISPLAY 1,1,,ENTER YOUR PASSWORD USED ON THIS SYSTEM: }
  933.    Clear the screen and prompt the user for a password.
  934.  
  935.    {GETSTRING-IP T}{CLEAR}
  936.    Get the password from the user.
  937.  
  938.    {SETVARIABLE F,%F%%T^) ^(}
  939.    Add the password to the dialing directory entry.
  940.  
  941. {:ADD_MACRO}
  942.    This label starts the preparation and completion of writing to the dialing
  943.    directory.
  944.  
  945.    {SETVARIABLE F,%F%%LRN_LBL,%LRN_MAC^) ^(^)}
  946.    Complete the dialing directory entry string here.
  947.  
  948.    {EXECUTE-S COPY %_HOM%%_FON %FON_FILE>NUL}
  949.    Make a copy of your dialing directory.
  950.  
  951.    {IFEXIST %FON_FILE,,RETURN}
  952.    Check and see if the copy was done correctly. If it was not, end the
  953.    routine.
  954.  
  955.    {RCLOSE}{ROPEN %FON_file,FON_FIN0}{WOPEN %_HOM%%_FON}
  956.    Open the COMMO dialing directory and the temporary file to write to here.
  957.  
  958.    {SETVARIABLE COUNT,0}
  959.    Reset the counter to 0.
  960.  
  961. {:ADD_RWL}
  962.    Here is where the read loop begins.
  963.  
  964.    {READ T}{WRITE %T}
  965.    Read a line from the dialing directory and write it out to the temporary
  966.    file.
  967.  
  968.    {COMPARE COUNT,1}{IFCONDITION-E ADD_RWL}
  969.    Check and see if we have already written a line to the temporary for the
  970.    new entry.  If so, just keep reading and writing.
  971.  
  972.    {INSTRING T,%CH}{IFCONDITION ,ADD_RWL}
  973.    Check and see if the line read is our system name.  If it is not, go get
  974.    another.
  975.  
  976.    {INCREMENT COUNT,1}{WRITE %F}{GOTO ADD_RWL}
  977.    Increment the counter.  Write the new dialing directory entry and go get
  978.    another line.
  979.  
  980. {:FON_FIN0}
  981.    This label is jumped to when the last line is read from .FON directory.
  982.  
  983.    {COMPARE COUNT,1}{IFCONDITION-E ADD_END}{WRITE %F}
  984.    See if we have already written the newly created dialing directory entry.
  985.    If we have, skip to the label shown.  Write the new dialing directory entry.
  986.  
  987. {:ADD_END}
  988.    {WCLOSE}
  989.    Close the file.
  990.  
  991.    {SETR FON_ERR}{FONFILE %_FON}{SETR}{RETURN}
  992.    Re-load the dialing directory. If this is not a registered version of
  993.    {COMMO} use the EXECUTE function method.
  994.  
  995. {:FON_ERR}
  996.    Since this is not a registered version of {COMMO}, reload the dialing
  997.    directory by swapping to DOS and come right back.
  998.  
  999.    {EXECUTE-S VER>NUL}{SETR}{RETURN}
  1000.  
  1001. {:QUIT}
  1002.    Quit routine.
  1003.  
  1004.    {NOCARRIER}{EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
  1005.    Reset the NOCARRIER macro function. Check and see if the capture file
  1006.    exists.  If it does, delete it.
  1007.  
  1008.    {COMPARE LRN_MAC}{IFCONDITION Q_RESET}{IFEXIST %_HOM%%LRN_MAC,,q_reset}
  1009.    If no macro has been started, jump to the end of the quit routine.
  1010.  
  1011.    {COMPARE LOOK_FOR}{IFCONDITION QUIT1}
  1012.    Look and see if we have a BBS prompt available.
  1013.  
  1014.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE}{WCLOSE}
  1015.    Write one last LOOKFOR for the ending BBS prompt if one exists.
  1016.  
  1017. {:QUIT1}
  1018.    CLEAR SSLOOK VARIABLES OUT OF {COMMO} VARIABLE SPACE.
  1019.  
  1020.    {SETVARIABLE COUNT,0}
  1021.    Clear variables and get counter ready for loop below.
  1022.  
  1023. {:SSLKLOOP}
  1024.    This is the loop that will clear those variables defined during the
  1025.    learn. Clearing commands will also be written to the macro file.
  1026.  
  1027.    {INCREMENT COUNT,1}{COMPARE SLR_%COUNT}{IFCONDITION END_MACR}
  1028.    Increment the SSLOOK counter.
  1029.  
  1030.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE SLR_%COUNT^)}{WCLOSE}
  1031.    Open the macro file and write code to clear this variable out.
  1032.  
  1033.    {SETVARIABLE SLF_%COUNT}{SETVARIABLE SLR_%COUNT}{SETVARIABLE SLT_%COUNT}
  1034.    {GOTO SSLKLOOP}
  1035.    Clear this variable and go get another one if it is available.
  1036.  
  1037. {:END_MACR}
  1038.  
  1039.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE ESCAPE_2^)}
  1040.    {WRITE ^(INFORM-D1 LOGIN COMPLETE ...^) ^(STOP^)}{WCLOSE}
  1041.    Open the macro file.  Write the ending commands to the macro file.
  1042.    Close the macro file.
  1043.  
  1044. {:Q_RESET}
  1045.  
  1046.    {CALL ADD_FON}{CLEAR}
  1047.    Add an entry to your dialing directory for this learn macro script just
  1048.    created.
  1049.  
  1050.    Reset all variables used during learn operation.
  1051.  
  1052.    {SETVARIABLE CAPTFILE}{SETVARIABLE DATAFILE}{SETVARIABLE LRN_MAC}
  1053.    {SETVARIABLE FON_FILE}{SETVARIABLE LRN_LBL}{SETVARIABLE WAITTIME}
  1054.    {SETVARIABLE KEY}{SETVARIABLE COUNT}{SETVARIABLE POS}{SETVARIABLE T}
  1055.    {SETVARIABLE ESCAPE_2}{SETVARIABLE I}{SETVARIABLE CH}{SETVARIABLE AUTORESP}
  1056.    {SETVARIABLE LOOK_FOR}{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
  1057.    {SETVARIABLE F}{SETVARIABLE NOV_MENU}{SETVARIABLE SLKLIMIT}
  1058.    {SETVARIABLE SSLKAUTO}{SETVARIABLE SSLK_CNT}
  1059.    {INFORM-D1 JB-LEARN VERSION 1.2 IS COMPLETE ...}{UNLO}
  1060.    Inform the user that processing is complete and stop macro execution.
  1061.  
  1062. {:BRINGFWD}
  1063.    This routine will bring forward those SSLOOK definitions desired after
  1064.    writing the LOOKFOR/SEND combination.
  1065.  
  1066.    {SETVARIABLE SSLK_CNT,0}{SETVARIABLE COUNT,0}{SETVARIABLE T}
  1067.    Clear out variables used in this routine.
  1068.  
  1069. {:fwd_loop}
  1070.    Begin the forward loop.
  1071.  
  1072.    {COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L ,END_FWD}
  1073.    See if we have reached the SSLOOK limit.  If so, quit now.
  1074.  
  1075.    {INCREMENT COUNT,1}
  1076.    Increment the counter.
  1077.  
  1078.    {COMPARE SLR_%COUNT}{IFCONDITION END_FWD}
  1079.    See if there is a response string defined here.  If not, quit.
  1080.  
  1081.    {COMPARE SLF_%COUNT,Y}{IFCONDITION ,FWD_LOOP}
  1082.    See if this SSLOOK combination is coming forward.  If it is not, loop
  1083.    back for another.
  1084.  
  1085.    {SETVARIABLE-S T,SLT_%COUNT}
  1086.    {WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SSLOOK SLR_%COUNT,%T^)}{WRITE}{WCLOSE}
  1087.    Write the data to the macro file.
  1088.  
  1089.    {INCREMENT SSLK_CNT,1}{GOTO FWD_LOOP}
  1090.    Increment the SSLOOK counter and go back for another one.
  1091.  
  1092. {:END_FWD}
  1093.    {SETVARIABLE T}{SETVARIABLE COUNT}
  1094.    Clear the variables used in this routine.  Return to the calling routine.
  1095.  
  1096. {:RETURN}
  1097.    A very useful macro label to cause a return.
  1098.  
  1099.    {RETURN}
  1100.